{php $bootstrap_type = 3;}
{template 'header'}
<link type="text/css" rel="stylesheet" href="../addons/ewei_shopping/images/style.css?{TIMESTAMP}">
<div class="head">
	<a href="javascript:history.back();" class="bn pull-left"><i class="fa fa-angle-left"></i></a>
	<span class="title">订单详情</span>
	<a href="{php echo $this->createMobileUrl('mycart')}" class="bn pull-right"><i class="fa fa-shopping-cart"></i></a>
</div>

<div class="myoder img-rounded">
	<div class="myoder-hd">
		<span class="pull-left">订单编号：{$item['ordersn']}</span>
		<span class="pull-right">{php echo date('Y-m-d H:i', $item['createtime'])}</span>
	</div>
	{loop $goods $g}
	<div class="myoder-detail">
		<a href="{php echo $this->createMobileUrl('detail', array('id' => $g['id']))}">
			<img src="{php echo tomedia($g['thumb']);}" width="160" />
		</a>
		<div class="pull-left">
			<div class="name"><a href="{php echo $this->createMobileUrl('detail', array('id' => $g['id']))}">{$g['title']}</a></div>
			<div class="price">
				<span>{$g['marketprice']} 元{if $g['unit']} / {$g['unit']}{/if}</span>
				<span class="num">{$g['total']}  {if $g['unit']} {$g['unit']}{/if}</span>
			</div>
		</div>
	</div>
	{/loop}
	<div class="myoder-express">
		<span class="express-company">状态</span>
		<span class="express-num">
		{if $item['paytype'] == 3}
			{if $item['status'] == -1}
			<span class="text-muted">订单取消</span>
			{elseif $item['status'] < 3}
			<span class="text-danger">货到付款 / 未付款</span>
			{else}
			<span class="text-success">已完成</span>
			{/if}
		{else}
			{if $item['status'] == -1}
			<span class="text-muted">订单取消</span>
			{elseif $item['status'] == 0}
			<span class="text-danger">未付款</span>
			{elseif $item['status'] == 1}
			<span class="text-warning">已付款</span>
			{elseif $item['status'] == 2}
			<span class="text-warning">已发货</span>
			{else}
			<span class="text-success">已完成</span>
			{/if}
		{/if}
		</span>
	</div>

	<div class="myoder-express">
		<span class="express-company">金额</span>
		<span class="express-num">
			<span class="false">
			{if $item['dispatchprice']<=0}
				{$item['price']} 元
			{else}
				{$item['price']} 元 (含运费 {$item['dispatchprice']} 元)
			{/if}
			</span>
		</span>
	</div>
    {if ($dispatch['enabled']==1)}
	<div class="myoder-express">
		<span class="express-company">配送方式</span>
		<span class="express-num">{$dispatch['dispatchname']}</span>
	</div>
	{/if}
	{if ($item['status'] == '2' || $item['status']==3) && !empty($item['expresssn'])}
	<div class="myoder-express">
		<span class="express-company">快递: {$item['expresscom']}</span>
		<span class="express-num">
			单号: {$item['expresssn']}
		</span>
	</div>
	{/if}
	{if !empty($item['remark'])}
	<div class="myoder-express" style='margin-top:10px;'>
		<span class="express-company">订单备注&nbsp;&nbsp;:&nbsp;&nbsp;{$item['remark']}</span>
	</div>
	{/if}
	<div class="myoder-total">
		{if !empty($item['paydetail'])}
		<span>
			<span class="false"><strong>支付详情：</strong></span>
			{$item['paydetail']}
		</span>
		{/if}
		<div class="form-group">
		{if $item['status'] == '2' && !empty($item['expresssn'])}
			<a href="http://m.kuaidi100.com/index_all.html?type={$item['express']}&postid={$item['expresssn']}#input" class="btn btn-success pull-right btn-sm" >查看快递</a>
		{/if}
		{if $item['paytype'] != 3 && $item['status'] == 0}
			<a href="{php echo $this->createMobileUrl('pay', array('orderid' => $item['id']))}" class="btn btn-danger pull-right btn-sm">立即支付</a>
		{else}
			{if $item['status'] == 3}
			<button class="btn btn-success pull-right btn-sm">已完成</button>
			{elseif $item['status'] == 2}
			<a href="{php echo $this->createMobileUrl('myorder', array('orderid' => $item['id'], 'op' => 'confirm'))}" class="btn btn-warning pull-right btn-sm" style="margin-right: 10px;" onclick="return confirm('点击确认收货前，请确认您的商品已经收到。确定收货吗？'); ">确认收货</a>
			{else}
			<button class="btn btn-danger pull-right btn-sm">等待发货</button>
			{/if}
		{/if}
		</div>
	</div>
</div>

<script>
	document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
		WeixinJSBridge.call('hideOptionMenu');
	});
</script>

{template 'footer'}
{template 'footerbar'}